CREATE TABLE [dbo].[tb_EfectosDeZonas]
(
[idEfectoDeZona] [int] NOT NULL IDENTITY(1, 1),
[Descripcion] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE TRIGGER [dbo].[updatetb_EfectosDeZonas] ON [dbo].[tb_EfectosDeZonas]
 FOR UPDATE AS 
 IF (update(idEfectoDeZona)) begin 
	 SELECT * FROM inserted 
	 IF @@ROWCOUNT = 1 begin 
		 UPDATE tb_zonas
		 SET ALosEfectosDe = (SELECT idEfectoDeZona FROM inserted)
		 WHERE tb_zonas.ALosEfectosDe = (SELECT idEfectoDeZona FROM deleted)
	end  ELSE begin 
		 ROLLBACK TRANSACTION 
 end 
 end 
GO
ALTER TABLE [dbo].[tb_EfectosDeZonas] ADD CONSTRAINT [PK_tb_EfectosDeZonas] PRIMARY KEY NONCLUSTERED  ([idEfectoDeZona]) ON [PRIMARY]
GO
